package app.controller.msgmanage;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;


public class MsgAccessFilter implements Filter {
	
	FilterConfig config;

	@Override
	public void destroy() {
		config = null;
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		HttpServletRequest requ = (HttpServletRequest) request;
		
		String method = requ.getMethod();
		
		if (method.equals("POST")) {
			chain.doFilter(request, response);
		}else{
			System.out.println("禁止GET请求！");
		}
		
	}

	@Override
	public void init(FilterConfig config) throws ServletException {
		
		this.config = config;
	}

}
